#ifndef SIDEWIDGET_H
#define SIDEWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QTabWidget>
#include "ConnectFour.h"
#include "HostWidget.h"
#include "ConnectWidget.h"
#include "ChatWidget.h"
#include "GuiParameters.h"

#include <QDebug>

class SideWidget : public QWidget {

    Q_OBJECT

    typedef enum {
        HOST_TAB = 0,
        CONNECT_TAB,
        CHAT_TAB
    } TabWidgetIndices;

public:
    explicit SideWidget(QWidget *parent = 0);
    ChatWidget * getChatWidget() const;

signals:
    void connectionStatusChanged(Network::ConnectionStatus status);
    void newConnection(Network::ConnectionStatus status, QTcpSocket * socket);

public slots:
    void changeTurn(ConnectFour::Piece piece);
    void incrementScore(ConnectFour::Piece piece);
    void changeConnectionStatus(Network::ConnectionStatus status);

private slots:
    void disconnectOnClick();

private:
    void createWidgets();
    void createLayouts();
    void connectSignalSlots();
    void resetScore();
    void setChatTabOnly(bool enabled);

    QLabel * redLabel;
    QLabel * redScoreLabel;
    QLabel * blackLabel;
    QLabel * blackScoreLabel;
    QLabel * currentTurnLabel;
    QLabel * turnLabel;
    QLabel * statusLabel;
    QLabel * connectionStatusLabel;
    QTabWidget * tabWidget;
    HostWidget * hostTab;
    ConnectWidget * connectTab;
    ChatWidget * chatTab;
    QPushButton * disconnectButton;

    Network::ConnectionStatus connectionStatus;

    int redScore;
    int blackScore;

};

#endif // SIDEWIDGET_H
